string = input()
judge1 = len(string) >= 8
judge2 = string.isalnum()
judge3 = False
if judge1 == False:
    print(1)
if judge2 == False:
    print(2)
for i in range(0,len(string)):
    if ord(string[i]) >= 65 and ord(string[i]) <= 90:
        for j in range(0,len(string)):
            if ord(string[j]) >= 48 and ord(string[j]) <= 57:
                judge3 = True
                break
if judge3 == False:
    print(3)
if judge1 == judge2 == judge3 == True:
    print(0)